package com.zhangjie.servicemap.controller;

import com.zhangjie.internalcommon.dto.ResponseResult;
import com.zhangjie.internalcommon.response.TerminalResponse;
import com.zhangjie.internalcommon.response.TrsearchResponse;
import com.zhangjie.servicemap.service.TerminalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Auther: zj
 * @Date: 2024/2/29 - 02 - 29 - 11:51
 * @Description: com.zhangjie.servicemap.controller
 * @version: 1.0
 */
@RestController
@RequestMapping("/terminal")
public class TerminalController {

    @Autowired
    private TerminalService terminalService;

    @PostMapping("/add")
    public ResponseResult<TerminalResponse> add(String name, String desc) {

        return terminalService.add(name, desc);
    }

    @PostMapping("/aroundsearch")
    public ResponseResult<List<TerminalResponse>> aroundsearch(String center, Integer radius) {

        return terminalService.aroundsearch(center, radius);
    }

    @PostMapping("/trsearch")
    public ResponseResult<TrsearchResponse> trsearch(String tid, Long starttime, Long endtime) {

        return terminalService.trsearch(tid, starttime, endtime);
    }
}
